<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <base href="${basePath}" target="_self"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>单位列表</title> 
    <#include "/template/head.html">
    <script type="text/javascript">
    $(function() {
      var curPageNo = ${pagination.pageNo};
      var totalPage = ${pagination.totalPage};
      var _pageNo = $('#pageNo'), _pageForm = $('#dwdmListForm');
      var _first = $('#first'),  _back = $('#back'), _next = $('#next'), _last = $('#last');
      
      if(curPageNo> 1){
      	_first.click(function() {
          _pageNo.val(1);
          _pageForm.submit();
        });
      	_first.addClass('pointer');
        _back.click(function() {
          _pageNo.val(parseInt(curPageNo)-1);
          _pageForm.submit();
        });
        _back.addClass('pointer');
      }
      
      if(curPageNo < totalPage){
      	_last.click(function() {
          _pageNo.val(totalPage);
          _pageForm.submit();
        });
        _last.addClass('pointer');
        _next.click(function() {
          _pageNo.val(parseInt(curPageNo)+1);
          _pageForm.submit();
        });
        _next.addClass('pointer');
      }
      
      _pageForm.validate({
        rules:{
          pageSize: {required:true, min:1},
          pageNo: {range:[1,totalPage]}
        },
        messages:{
          pageSize: {required: "每页要显示多少条数据", min: "每页最少显示一条数据"},
          pageNo: {range: "页码范围在1和" + totalPage + "之间"}
        },
        errorPlacement: function(error, element) {   
          alert(error.html());
        }
      });
    });
    </script>
  </head>

  <body>
    <form id="dwdmListForm" action="${basePath}admin/dwdm/list.do" method="post">
      <table class="cmxform" cellspacing="1">
        <tr>
          <th width="70">角色名称：</th>
          <td width="100">
            <select name="role.id">
              <option value="">---全部---</option>
              <#list roles as r>
              <option value="${r.id}" <#if dwdm.role?? && dwdm.role.id?? && dwdm.role.id==r.id> selected </#if>>${r.roleName}</option>
              </#list>
            </select>
          </td>
          <th width="70">登录名：</th>
          <td width="100"><input name="dlmc" value="${dwdm.dlmc!}" class="w80"/></td>
          <th width="90">单位名称：</th>
          <td width="150"><input name="dwmc" value="${dwdm.dwmc!}" class="w120"/></td>
          <th width="90">被禁用：<input name="disabled" type="checkbox" <#if dwdm.disabled?? && dwdm.disabled>checked</#if>/></th>
          <td><button type="submit" class="search"/></td>
          <td width="62"><a href="${basePath}admin/dwdm/add.do"><img src="img/add.png" class="noborder"/></a></td>
        </tr>
      </table>
      <table>
        <tr>
          <td>
            <table width="100%">
              <tr>
                <td width="15" height="30" style="background: url('img/tab_03.gif') no-repeat;">&nbsp;</td>
                <td style="background: url(${basePath}img/tab_05.gif) repeat-x ;">
                  <img src="img/311.gif" width="16" height="16" />
                  <h5 class="inline shadow">单位列表</h5>
                </td>
                <td width="14" height="30" style="background: url('img/tab_07.gif') no-repeat;">&nbsp;</td>
              </tr>
            </table>
          </td>
        </tr>
        <tr>
          <td>
            <table width="100%">
              <tr>
                <td style="background: url(img/tab_12.gif);width: 9px;">&nbsp;</td>
                <td style="background: #f3ffe3;">
                  <table class="list" cellspacing="1" onmouseover="changeto();" onmouseout="changeback();">
                    <thead>
                      <tr>
                        <th width="50">序号ID</th>
                        <th>登录名称</th>
                        <th>单位名称</th>
                        <th>角色</th>
                        <th>Email</th>
                        <th>QQ</th>
                        <th>TEL</th>
                        <th width="100" nowrap="nowrap">操作</th>
                      </tr>
                    </thead>
                    <#list pagination.list as d>
                    <tr style="background: #FFF">
                      <td style="text-align: left;padding: 0 6px;">${d.dwid!}</td>
                      <td>${d.dlmc!}</td>
                      <td>${d.dwmc!}</td>
                      <td>${d.role.roleName!}</td>
                      <td>${d.email!}</td>
                      <td>${d.qq!}</td>
                      <td>${d.tel!}</td>
                      <td nowrap="nowrap">
                        <img src="img/037.gif" width="9" height="9" />
                        <span> [</span><a href="${basePath}admin/dwdm/edit.do?id=${d.dwid}">编辑</a><span>]</span>
                        <#if d.disabled?? && d.disabled>
                        <img src="img/002.gif" width="9" height="9" />
                        <span> [</span><a href="${basePath}admin/dwdm/enable.do?id=${d.dwid}">恢复</a><span>]</span>
                        <#else>
                        <img src="img/010.gif" width="9" height="9" />
                        <span> [</span><a href="${basePath}admin/dwdm/delete.do?id=${d.dwid}" onclick="if(!confirm('你确定要禁用该单位吗？')){return false;}">禁用</a><span>]</span>
                        </#if>
                      </td>
                    </tr>
                    </#list>
                  </table>
                </td>
                <td style="background: url(${basePath}img/tab_16.gif); width: 9px;">&nbsp;</td>
              </tr>
            </table>
          </td>
        </tr>
        <tr>
          <td>
            <table width="100%">
              <tr>
                <td width="15" height="29" style="background: url('img/tab_20.gif') no-repeat;">&nbsp;</td>
                <td style="background: url(img/tab_21.gif) repeat-x;">
                  <table>
                    <tr>
                      <td width="25%" height="29" nowrap="nowrap">
                        <span>共${pagination.totalCount}条纪录，当前第${pagination.pageNo}/${pagination.totalPage}页，每页&nbsp;<input name="pageSize" value="${pagination.pageSize}" class="w20" onkeypress="if(event.keyCode==13){$('#roleListForm').submit();}"/>&nbsp;条纪录</span>
                      </td>
                      <td width="100000"></td>
                      <td>
                        <table width="340">
                          <tr align="center" valign="middle" style="height: 22px;">
                            <td width="48"><img id="first" src="img/first.gif" width="37" height="15" /></td>
                            <td width="52"><img id="back" src="img/back.gif" width="43" height="15" /></td>
                            <td width="52"><img id="next" src="img/next.gif" width="43" height="15" /></td>
                            <td width="48"><img id="last" src="img/last.gif" width="37" height="15" /></td>
                            <td width="52">转到第</td>
                            <td width="35"><input id="pageNo" name="pageNo" value="${pagination.pageNo}" style="width: 30px;" onkeypress="if(event.keyCode==13){$('#roleListForm').submit();}"/></td>
                            <td width="23">页</td>
                            <td width="30"><img src="img/go.gif" class="pointer" width="37" height="15" onclick="$('#roleListForm').submit();" /></td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
                </td>
                <td width="14" height="29" style="background: url('img/tab_22.gif') no-repeat;">&nbsp;</td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </form>
    <#include "/template/common/alert_message.html"/>
  </body>
</html>
